pkg_name=transmission
version=2.84
build_dir=$builds_dir_root/$pkg_name-$version
src_dir=$src_dir_root/$pkg_name-$version
url=https://transmission.cachefly.net/$pkg_name-$version.tar.xz

cd "$src_dir_root"
rm -Rf "$pkg_name-$version"
tar Jxf "$pkg_name-$version.tar.xz"

#fix libutp bool type handling
cd "$src_dir/third-party/libutp"
cp -f "$builders_dir_root/$pkg_name/libutp-utypes.h.patch" ./
patch -N -i ./libutp-utypes.h.patch

rm -Rf "$build_dir"
mkdir -p "$build_dir"
cd "$build_dir"

export CFLAGS=-O0
export OLD_PKG_CONFIG_PATH=$PKG_CONFIG_PATH
export PKG_CONFIG_PATH=/libexec/transmission-openssl/lib/pkgconfig:$PKG_CONFIG_PATH
export INTLTOOL_PERL=/libexec/intltool-perl/bin/perl
"$src_dir/configure"		\
	--prefix=/		\
	--disable-static	\
	--enable-largefile	\
	--disable-utp		\
	--enable-nls		\
	--disable-lightweight	\
	--enable-cli		\
	--disable-mac		\
	--enable-daemon		\
	--with-inotify		\
	--with-gtk		\
	--with-gnu-ld
unset INTLTOOL_PERL
if test -z "$OLD_PKG_CONFIG_PATH"; then
    unset PKG_CONFIG_PATH
else
    export PKG_CONFIG_PATH=$OLD_PKG_CONFIG_PATH
fi
unset CFLAGS

make

install_tmp_dir=/tmp/$pkg_name-$version
rm -Rf "$install_tmp_dir"
mkdir -p "$install_tmp_dir"
make install "DESTDIR=$install_tmp_dir"

install_dirs "$builders_dir_root/$pkg_name/runtime.dirs"
install_files "$builders_dir_root/$pkg_name/runtime.files" "$install_tmp_dir"
elf_strip "$builders_dir_root/$pkg_name/elf-strip"

rm -Rf "$install_tmp_dir"
rm -Rf "$build_dir"
rm -Rf "$src_dir"
